// #ifndef VUE3
import App from './App'
import store from '@/store/index.js'
import {
    eventBus
} from './App'; // 导入全局事件总线
import bluetoothTool from '@/static/libs/BluetoothTool.js'
import Vue from 'vue'
import './uni.promisify.adaptor'

Vue.config.productionTip = false
Vue.prototype.$blueToothTool = bluetoothTool;
Vue.prototype.$eventBus = eventBus; // 将eventBus设置为全局mixin
Vue.config.productionTip = false
App.mpType = 'app'
const msg = (title, icon = 'none', duration = 1500, mask = false) => {
    //统一提示方便全局修改
    if (Boolean(title) === false) {
        return;
    }
    uni.showToast({
        title,
        duration,
        mask,
        icon
    });
}
// 同步
const jsonConfig = (type) => {
    return JsonConfig[type];
}

const prePage = () => {
    let pages = getCurrentPages();
    let prePage = pages[pages.length - 2];
    // #ifdef H5
    return prePage;
    // #endif
    return prePage.$vm;
}

Vue.prototype.$api = {
    msg,
    jsonConfig,
    prePage
};
const app = new Vue({
    ...App,
    store
})
app.$mount()
// #endif

// #ifdef VUE3
import {
    createSSRApp
} from 'vue'

export function createApp() {
    const app = createSSRApp(App)
    return {
        app
    }
}

// #endif